﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Demo</title>
    <script src="../../Js/Jquery/core/jquery.core.js"></script>
    <script src="../../Js/Jquery/core/jquery.core.extend.js"></script>
    <script src="../../Js/Jquery/plugins/jquery.isotope.js"></script>
    <link href="../../Css/Core/CBase.css" rel="stylesheet" />
    <!--<link href="style.css" rel="stylesheet" />-->
    <script>
        var _count = 0;
        $(function () {
            var $container = $('#container');
            $container.isotope({
                itemSelector: '.element',
                // disable resizing
                resizable: false,
                // set columnWidth to a percentage of container width
                masonry: {
                    columnWidth: $container.width() / 10
                },
                sortBy: 'number',
                getSortData: {
                    symbol: function ($elem) {
                        return $elem.attr('data-symbol');
                    },
                    category: function ($elem) {
                        return $elem.attr('data-category');
                    },
                    number: function ($elem) {
                        return parseInt($elem.find('.number').text(), 10);
                    },
                    weight: function ($elem) {
                        return parseFloat($elem.find('.weight').text().replace(/[\(\)]/g, ''));
                    },
                    name: function ($elem) {
                        return $elem.find('.name').text();
                    }
                }
            });
            // change size of clicked element
            $container.delegate('.element', 'click', function () {
                $(".element").each(function () {
                    if ($(this).hasClass("large")) {
                        $(this).removeClass("large");
                    }
                });
                $(this).toggleClass('large');
                $(this).find(".number").text(_count);
                $container.isotope('updateSortData', $(this))
                $container.isotope('reLayout');
                $container.isotope({ sortBy: "number" });
                _count--;
            });
        });
</script>
</head>
<body>
    <div id="container" class="clickable variable-sizes clearfix">
        <div class="element transition metal   " data-symbol="Hg" data-category="transition">
            <p class="number">80</p>
            <h3 class="symbol">Hg</h3>
            <h2 class="name">Mercury</h2>
            <p class="weight">200.59</p>
        </div>
        <div class="element metalloid   " data-symbol="Te" data-category="metalloid">
            <p class="number">52</p>
            <h3 class="symbol">Te</h3>
            <h2 class="name">Tellurium</h2>
            <p class="weight">127.6</p>
        </div>
        <div class="element post-transition metal   " data-symbol="Bi" data-category="post-transition">
            <p class="number">83</p>
            <h3 class="symbol">Bi</h3>
            <h2 class="name">Bismuth</h2>
            <p class="weight">208.9804</p>
        </div>
        <div class="element transition metal   " data-symbol="Cd" data-category="transition">
            <p class="number">48</p>
            <h3 class="symbol">Cd</h3>
            <h2 class="name">Cadmium</h2>
            <p class="weight">112.411</p>
        </div>
        <div class="element alkaline-earth metal   " data-symbol="Ca" data-category="alkaline-earth">
            <p class="number">20</p>
            <h3 class="symbol">Ca</h3>
            <h2 class="name">Calcium</h2>
            <p class="weight">40.078</p>
        </div>
        <div class="element transition metal   " data-symbol="Re" data-category="transition">
            <p class="number">75</p>
            <h3 class="symbol">Re</h3>
            <h2 class="name">Rhenium</h2>
            <p class="weight">186.207</p>
        </div>
        <div class="element post-transition metal   " data-symbol="Tl" data-category="post-transition">
            <p class="number">81</p>
            <h3 class="symbol">Tl</h3>
            <h2 class="name">Thallium</h2>
            <p class="weight">204.3833</p>
        </div>
        <div class="element metalloid   " data-symbol="Sb" data-category="metalloid">
            <p class="number">51</p>
            <h3 class="symbol">Sb</h3>
            <h2 class="name">Antimony</h2>
            <p class="weight">121.76</p>
        </div>
        <div class="element transition metal   " data-symbol="Co" data-category="transition">
            <p class="number">27</p>
            <h3 class="symbol">Co</h3>
            <h2 class="name">Cobalt</h2>
            <p class="weight">58.933195</p>
        </div>
        <div class="element lanthanoid metal inner-transition   " data-symbol="Lu" data-category="lanthanoid">
            <p class="number">71</p>
            <h3 class="symbol">Lu</h3>
            <h2 class="name">Lutetium</h2>
            <p class="weight">174.9668</p>
        </div>
        <div class="element noble-gas nonmetal   " data-symbol="Ar" data-category="noble-gas">
            <p class="number">18</p>
            <h3 class="symbol">Ar</h3>
            <h2 class="name">Argon</h2>
            <p class="weight">39.948</p>
        </div>
        <div class="element alkali metal   " data-symbol="Rb" data-category="alkali">
            <p class="number">10</p>
            <h3 class="symbol">Rb</h3>
            <h2 class="name">Vinh test</h2>
            <p class="weight">85.4678</p>
        </div>
        <div class="element other nonmetal   " data-symbol="N" data-category="other">
            <p class="number">7</p>
            <h3 class="symbol">N</h3>
            <h2 class="name">Nitrogen</h2>
            <p class="weight">14.0067</p>
        </div>
        <div class="element actinoid metal inner-transition   " data-symbol="Np" data-category="actinoid">
            <p class="number">93</p>
            <h3 class="symbol">Np</h3>
            <h2 class="name">Neptunium</h2>
            <p class="weight">(237)</p>
        </div>
        <div class="element actinoid metal inner-transition   " data-symbol="Ac" data-category="actinoid">
            <p class="number">89</p>
            <h3 class="symbol">Ac</h3>
            <h2 class="name">Actinium</h2>
            <p class="weight">(227)</p>
        </div>
    </div>
</body>
</html>
